package com.woniuxy.woniubook.vo;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.lang.annotation.Documented;
import java.math.BigDecimal;
import java.util.Date;

@Document(indexName = "woniubook",shards = 3,replicas = 2)
@Data
public class EsBook implements Serializable {
    @Id
    private Long id;
    @Field(name = "name",analyzer = "ik_max_word",searchAnalyzer = "ik_smart",type = FieldType.Text)
    private String name;

    @Field(type = FieldType.Keyword)
    private Integer typeId;

    @Field(analyzer = "ik_max_word",searchAnalyzer = "ik_smart",type = FieldType.Text)
    private String typeName ;
    @Field(analyzer = "ik_max_word",searchAnalyzer = "ik_smart",type = FieldType.Text)
    private String provider;
    @Field(analyzer = "ik_max_word",searchAnalyzer = "ik_smart",type = FieldType.Text)
    private String author;

    @Field(type = FieldType.Double)
    private BigDecimal price;
    @Field(analyzer = "ik_max_word",searchAnalyzer = "ik_smart",type = FieldType.Text)
    private String detail;
    @Field(type = FieldType.Keyword)
    private String imgsrc;

    @Field(type = FieldType.Integer)
    private Integer collectioncount;

    @Field(type = FieldType.Integer)
    private Integer storecount;
    @Field(type = FieldType.Integer)
    private Integer buycount;
    /**
     * 点击量
     */
    @Field(type = FieldType.Integer)
    private Integer readcount;
    @Field(type = FieldType.Date,format = DateFormat.date)
    private Date createtime;
    @Field(type = FieldType.Date,format = DateFormat.date)
    private Date updatetime;
    @Field(type = FieldType.Integer)
    private Integer state;

}
